﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Model
{
    [Serializable]
    public partial class Bas1a40
    {
		private string _cntcode;
        private DateTime? _startdate;
        private DateTime? _endate;
		private string _slistid;
		private string _comcode;
		private string _comname;
		private string _lvlistid;
		private string _listid;
		private string _alistid;
		private string _splistid;
        private int? _paycycle;
        private DateTime? _paydate;
		private string _backmk;
		private double _mostamt;
		private double _foregift;
        private int? _status;
        private DateTime? _createdate;
		private double _lastamt;
		private string _muser;
		private string _way1;
		private string _way1key1;
		private string _way1key2;
		private string _way2;
		private string _way2key1;
		private string _way2key2;
		
        /// <summary>
        /// 合同代码
        /// </summary>
		public string Cntcode
		{
			get { return _cntcode;	 }
			set { _cntcode=value;	}
		}
        /// <summary>
        /// 开始日期
        /// </summary>
		public DateTime? Startdate
		{
			get { return _startdate;	 }
			set { _startdate=value;	}
		}
        /// <summary>
        /// 终止日期
        /// </summary>
		public DateTime? Endate
		{
			get { return _endate;	 }
			set { _endate=value;	}
		}
        /// <summary>
        /// 销售商主键
        /// </summary>
		public string Slistid
		{
			get { return _slistid;	 }
			set { _slistid=value;	}
		}
        /// <summary>
        /// 公司代码
        /// </summary>
		public string Comcode
		{
			get { return _comcode;	 }
			set { _comcode=value;	}
		}
        /// <summary>
        /// 公司名称
        /// </summary>
		public string Comname
		{
			get { return _comname;	 }
			set { _comname=value;	}
		}
        /// <summary>
        /// 合同级别主键
        /// </summary>
		public string Lvlistid
		{
			get { return _lvlistid;	 }
			set { _lvlistid=value;	}
		}
        /// <summary>
        /// 主键标识
        /// </summary>
		public string Listid
		{
			get { return _listid;	 }
			set { _listid=value;	}
		}
        /// <summary>
        /// 区域主键
        /// </summary>
		public string Alistid
		{
			get { return _alistid;	 }
			set { _alistid=value;	}
		}
        /// <summary>
        /// 门店主键
        /// </summary>
		public string Splistid
		{
			get { return _splistid;	 }
			set { _splistid=value;	}
		}
        /// <summary>
        /// 付款周期
        /// </summary>
		public int? Paycycle
		{
			get { return _paycycle;	 }
			set { _paycycle=value;	}
		}
        /// <summary>
        /// 付款日期
        /// </summary>
		public DateTime? Paydate
		{
			get { return _paydate;	 }
			set { _paydate=value;	}
		}
        /// <summary>
        /// 可否退货
        /// </summary>
		public string Backmk
		{
			get { return _backmk;	 }
			set { _backmk=value;	}
		}
        /// <summary>
        /// 最高可退金额
        /// </summary>
		public double Mostamt
		{
			get { return _mostamt;	 }
			set { _mostamt=value;	}
		}
        /// <summary>
        /// 押金
        /// </summary>
		public double Foregift
		{
			get { return _foregift;	 }
			set { _foregift=value;	}
		}
        /// <summary>
        /// 状态
        /// </summary>
		public int? Status
		{
			get { return _status;	 }
			set { _status=value;	}
		}
        /// <summary>
        /// 创建日期
        /// </summary>
		public DateTime? Createdate
		{
			get { return _createdate;	 }
			set { _createdate=value;	}
		}
        /// <summary>
        /// 最低付款金额
        /// </summary>
		public double Lastamt
		{
			get { return _lastamt;	 }
			set { _lastamt=value;	}
		}
        /// <summary>
        /// 用户标识
        /// </summary>
		public string Muser
		{
			get { return _muser;	 }
			set { _muser=value;	}
		}
        /// <summary>
        /// 方案1
        /// </summary>
		public string Way1
		{
			get { return _way1;	 }
			set { _way1=value;	}
		}
        /// <summary>
        /// 方案1值1
        /// </summary>
		public string Way1key1
		{
			get { return _way1key1;	 }
			set { _way1key1=value;	}
		}
        /// <summary>
        /// 方案1值2
        /// </summary>
		public string Way1key2
		{
			get { return _way1key2;	 }
			set { _way1key2=value;	}
		}
        /// <summary>
        /// 方案2
        /// </summary>
		public string Way2
		{
			get { return _way2;	 }
			set { _way2=value;	}
		}
        /// <summary>
        /// 方案2值1
        /// </summary>
		public string Way2key1
		{
			get { return _way2key1;	 }
			set { _way2key1=value;	}
		}
        /// <summary>
        /// 方案2值2
        /// </summary>
		public string Way2key2
		{
			get { return _way2key2;	 }
			set { _way2key2=value;	}
		}
		
		public static List<Bas1a40> GetBas1a40ListByDataTable(DataTable dt)
		{
			if(dt == null) return null;
		    List<Bas1a40> list = new List<Bas1a40>();
		   
			foreach(DataRow dr in dt.Rows)
            {
				Bas1a40 model = GetBas1a40ByDataRow(dr);
				if(null == model) continue;
				
				list.Add(model);
            }
           return list;
		}
		
		public static Bas1a40 GetBas1a40ByDataRow(DataRow dr)
		{
			Bas1a40 model = new Bas1a40(); //实例化Bas1a40
	
			DataColumnCollection dcc = dr.Table.Columns;

			if (dcc.Contains("cntcode")&&!(dr["cntcode"] is System.DBNull))  
				model.Cntcode = ( string)dr["cntcode"];
			if (dcc.Contains("startdate")&&!(dr["startdate"] is System.DBNull))  
				model.Startdate = ( DateTime)dr["startdate"];
			if (dcc.Contains("endate")&&!(dr["endate"] is System.DBNull))  
				model.Endate = ( DateTime)dr["endate"];
			if (dcc.Contains("slistid")&&!(dr["slistid"] is System.DBNull))  
				model.Slistid = ( string)dr["slistid"];
			if (dcc.Contains("comcode")&&!(dr["comcode"] is System.DBNull))  
				model.Comcode = ( string)dr["comcode"];
			if (dcc.Contains("comname")&&!(dr["comname"] is System.DBNull))  
				model.Comname = ( string)dr["comname"];
			if (dcc.Contains("lvlistid")&&!(dr["lvlistid"] is System.DBNull))  
				model.Lvlistid = ( string)dr["lvlistid"];
			if (dcc.Contains("listid")&&!(dr["listid"] is System.DBNull))  
				model.Listid = ( string)dr["listid"];
			if (dcc.Contains("alistid")&&!(dr["alistid"] is System.DBNull))  
				model.Alistid = ( string)dr["alistid"];
			if (dcc.Contains("splistid")&&!(dr["splistid"] is System.DBNull))  
				model.Splistid = ( string)dr["splistid"];
			if (dcc.Contains("paycycle")&&!(dr["paycycle"] is System.DBNull))  
				model.Paycycle = ( int)dr["paycycle"];
			if (dcc.Contains("paydate")&&!(dr["paydate"] is System.DBNull))  
				model.Paydate = ( DateTime)dr["paydate"];
			if (dcc.Contains("backmk")&&!(dr["backmk"] is System.DBNull))  
				model.Backmk = ( string)dr["backmk"];
			if (dcc.Contains("mostamt")&&!(dr["mostamt"] is System.DBNull))  
				model.Mostamt = Convert.ToDouble(dr["mostamt"]);
			if (dcc.Contains("foregift")&&!(dr["foregift"] is System.DBNull))  
				model.Foregift = Convert.ToDouble(dr["foregift"]);
			if (dcc.Contains("status")&&!(dr["status"] is System.DBNull))  
				model.Status = ( int)dr["status"];
			if (dcc.Contains("createdate")&&!(dr["createdate"] is System.DBNull))  
				model.Createdate = ( DateTime)dr["createdate"];
			if (dcc.Contains("lastamt")&&!(dr["lastamt"] is System.DBNull))  
				model.Lastamt = Convert.ToDouble(dr["lastamt"]);
			if (dcc.Contains("muser")&&!(dr["muser"] is System.DBNull))  
				model.Muser = ( string)dr["muser"];
			if (dcc.Contains("way1")&&!(dr["way1"] is System.DBNull))  
				model.Way1 = ( string)dr["way1"];
			if (dcc.Contains("way1key1")&&!(dr["way1key1"] is System.DBNull))  
				model.Way1key1 = ( string)dr["way1key1"];
			if (dcc.Contains("way1key2")&&!(dr["way1key2"] is System.DBNull))  
				model.Way1key2 = ( string)dr["way1key2"];
			if (dcc.Contains("way2")&&!(dr["way2"] is System.DBNull))  
				model.Way2 = ( string)dr["way2"];
			if (dcc.Contains("way2key1")&&!(dr["way2key1"] is System.DBNull))  
				model.Way2key1 = ( string)dr["way2key1"];
			if (dcc.Contains("way2key2")&&!(dr["way2key2"] is System.DBNull))  
				model.Way2key2 = ( string)dr["way2key2"];
			
			return model;
		}
    }
}
